Feat/sat device uptime decrypt#40
Merged
Merged
Conversation
sat scan --key now decrypts both UNIX_TIME (day-based) and DEVICE_UPTIME (0-127 counter pool) satellite packets. decrypt_satellite() gains a counter_mode param mirroring decrypt(); the shared validation is factored into _normalize_counter_mode(). The CLI auto-detects the counter source when --key is given without --counter-mode (trying UNIX_TIME then DEVICE_UPTIME, caching the resolved mode for the stream) and announces it, mirroring ble scan. A --counter-mode option forces a mode and skips detection, with the same DEVICE_UPTIME requires-key / mutually-exclusive-with-days guards as ble scan.
…atellite The BLE and satellite scan paths each carried a verbatim copy of the UNIX_TIME/DEVICE_UPTIME detect → cache → announce loop, plus the "days only applies to UNIX_TIME" kwargs rule duplicated four times. Extract one core, _detect_ctr_counter_mode(), that owns the loop and the kwargs rule. Each path now passes a one-line packet-bound decrypt_fn adapter (decrypt vs decrypt_satellite) and a cache key (BLE EID, or a per-stream sentinel for satellite, since satellite packets have no EID). cache_key=None disables caching for EID-less BLE packets, preserving prior behavior. Behavior is unchanged; existing CLI tests cover both paths.
…e guard
counter_mode defaults to UNIX_TIME, so `counter_mode == DEVICE_UPTIME` already
implies the user passed the flag explicitly. Removing the redundant
`_explicit("counter_mode")` conjunct makes the satellite guard match the
ble scan/detect guards exactly, eliminating cross-command drift.
No behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.